Skip to main content

DigiLocker Fetch PAN and Driving Licence API

The following document highlights the details of the DigiLocker Fetch PAN and Driving Licence API.

API Description

Objective

The DigiLocker Fetch PAN and Driving Licence API retrieves the driving license and the Permanent Account Number (PAN) details of the customer from their DigiLocker account.

Note
This is available only if the driving license and the PAN details are issued in the customer's DigiLocker account.
InputOutput
A unique reference identifierThe driving license and PAN details of the customer in a JSON response, including their name, date of birth, address, photo, and other relevant information

API URL

https://ind-verify.hyperverge.co/api/digilocker/docDetails

API Endpoint

docDetails

Overview

The DigiLocker Fetch PAN and Driving Licence API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.

Method - POST

Authentication

You need a unique pair of application ID ( appId ) and application key ( appKey ) from HyperVerge to verify your identity for accessing the API.

Headers

HeaderMandatory / OptionalDescriptionInput Format
content-type MandatoryThis parameter defines the media type for the request payloadapplication/json
appId MandatoryThe application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
appKey MandatoryThe application key shared by HyperVerge. You can find the details in the dashboard's credentials tabThis should be a unique value
transactionIdOptionalA unique identifier for tracking a user journeyThis should be both unique and easily associated with the user's journey in your application(s)

Inputs

The following table provides the details of the parameters required for the DigiLocker Fetch PAN and Driving Licence API's request body:

ParameterMandatory / OptionalTypeDescriptionInput FormatDefault Value
referenceIdMandatorystringThe unique reference identifier generated in the initial requestNot ApplicableNot Applicable
panOptionalstringThe parameter that confirms if the API should fetch the PAN details from the DigiLocker accountyes / noNot Applicable
dlOptionalstringThe parameter that confirms if the API should fetch the Driving License (DL) details from the DigiLocker accountyes / noNot Applicable
panFileOptionalstringThe parameter, when set to yes, controls whether the PAN file should be fetched from the user's DigiLocker account. The pan file will be returned in the form of an s3 url that will be valid for 15 minutesyes / noNot Applicable
dlFileOptionalstringThe parameter, when set to yes, controls whether the driving license file should be fetched from the user's Digilocker account. The DL file will be returned in the form of an s3 url that will be valid for 15 minutesyes / noNot Applicable
blockMinorsOptionalstringThe parameter that controls whether a 400 response is returned if the DigiLocker account belongs to a minor. When set to "yes", the API returns a 400 responseNot ApplicableNot Applicable
returnAllFieldsFromDigilockerOptionalstringThe parameter that controls whether all fields for PAN and DL are retrieved from the DigiLocker account. When set to "yes", the API retrieves all available fieldsyes / nono
useV2StorageLocationOptionalstringThe parameter that enables dashboard visibility. When set to "yes", you can view the data in the dashboardyes / nono
enableRetryOptionalstringThe parameter that controls retry behavior. When set to "yes", the API retries the same request three times before generating a responseyes / nono
returnFileNotFoundErrorOptionalstringThe parameter that controls whether a file not found error is returned. When set to "yes", returns file not found error if failed to fetch pan/dl files after 3 retries. Note: This parameter should be passed only when enableRetry is set to "yes"Not ApplicableNot Applicable
returnSummaryOptionalstringThe parameter that controls whether a summary key is returned in the response. When set to "yes", returns summary key in responseyes / nono

Request

The following code snippet demonstrates a standard curl request for the DigiLocker Fetch PAN and Driving Licence API:

curl --location --request POST 'https://ind-verify.hyperverge.co/api/digilocker/docDetails' \
--header 'Content-Type: application/json' \
--header 'appID: <Enter_the_HyperVerge_appId>'\
--header 'appKey: <Enter_the_HyperVerge_appKey>'\
--header 'transactionID: <Enter_the_HyperVerge_transactionID>' \
--data-raw '{
"referenceId": "<Reference_ID>",
"pan": "<yes_or_no>",
"dl": "<yes_or_no>",
"panFile": "<yes_or_no>",
"dlFile": "<yes_or_no>",
"panXMLFile": "<yes_or_no>"
"dlXMLFile": "<yes_or_no>"
"returnAllFieldsFromDigilocker": "<yes_or_no>",
"useV2StorageLocation": "<yes_or_no>",
"enableRetry": "<yes_or_no>"
}'

Success Responses

The following code snippets demonstrate success responses from the DigiLocker Fetch PAN and Driving Licence API:

{
"status": "success",
"statusCode": "200",
"result": {
"code": "ALL_FOUND",
"docs_found": [
"pan",
"dl"
],
"details": [
{
"doc_type": "",
"pan": "",
"name": "",
"dob": ""
},
{
"doc_type": "",
"dl": "",
"name": "",
"dob": "",
"address": "[object Object],, [object Object]",
"photo": "base64"
}
]
}
}

Success Response Details

The following table outlines the details of the success response from the DigiLocker Fetch PAN and Driving Licence API:

ParameterTypeDescription
statusstringThe status of the request
statusCodestringThe HTTP status code for the response
resultobjectThe JSON object containing the driving license and PAN details
result.codestringThe code indicating which documents were found (e.g., "ALL_FOUND", "PAN_FOUND", "DL_FOUND", "NO_DOC_FOUND")
result.docs_foundarrayAn array of document types found (e.g., ["pan"], ["dl"], ["pan", "dl"])
result.detailsarrayAn array of objects containing the document details
result.details[].doc_typestringThe type of document (e.g., "pan", "driving_licence", "dl")
result.details[].panstringThe PAN number of the customer
result.details[].dlstringThe driving license number of the customer
result.details[].namestringThe name of the customer
result.details[].dobstringThe date of birth of the customer
result.details[].genderstringThe gender of the customer
result.details[].photostringThe base64 string of the customer's profile photo (for DL)
result.details[].addressstring or objectThe address of the customer (can be a string or an object with "present" and "permanent" fields for DL)
result.details[].filestringThe S3 URL for the document file
result.details[].issue_datestringThe issue date of the document
result.details[].valid_uptostringThe validity date of the driving license
result.details[].authorised_categoriesarrayAn array of authorized vehicle categories for the driving license

Error Responses

The following are some error responses from the DigiLocker Fetch PAN and Driving Licence API:

This error is returned when the enableRetry parameter is enabled in the request, in the scenario when the files are not fetched even after multiple retries.

{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_FILE_NOT_FETCHED",
"message": "could not fetch file from digilocker."
}
}

The following code snippet is returned when the parameter blockMinors is enabled in the request body:

{
"status": "failure",
"statusCode": "400",
"error": {
"code": "ER_MINOR_ACCOUNT",
"message": "Entered details belongs to a minor."
}
}

Error Response Details

A failure or error response contains a failure status with a relevant status code and error message.
The following table lists all error responses:

Status CodeError MessageError DescriptionError Resolution
400referenceId is requiredThe mandatory referenceId parameter is missing from the requestProvide valid referenceId in the request
400pan is requiredThe mandatory pan parameter is missing from the requestProvide valid pan parameter in the request
400Please try verifying the refIdThe provided referenceId is invalidVerify and provide a valid referenceId
400could not fetch file from digilocker.Files could not be fetched from DigiLocker even after multiple retries (when enableRetry is set to "yes")Please try again after sometime or contact the HyperVerge team
400consent not provided by user for the document.The user rejected consent to access their document from DigiLockerPlease ensure user provides consent or try again
400Entered details belongs to a minor.The entered details belong to a minor accountPlease ensure the user is not a minor or contact the HyperVerge team
400PAN Name does not match with Digilocker dataThe PAN name does not match the associated name in the user's DigiLocker accountPlease ensure the PAN name matches the Aadhaar name in the user's DigiLocker account
401Missing/Invalid credentialsThe request is either missing the mandatory appId and appKey combination or has invalid valuesProvide valid appId and appKey credentials in the request
422No data found for the given panNo PAN data found for the provided input in the user's DigiLocker accountPlease ensure the user has PAN document in their DigiLocker account
422No data found for the given DLNo Driving License data found for the provided input in the user's DigiLocker accountPlease ensure the user has Driving License document in their DigiLocker account
500Something went wrongThere was an error with HyperVerge's serverPlease check the request headers or contact the HyperVerge team for resolution
503Error Connecting to digilocker. Please try again after sometimeDigiLocker repository service returned an error (ER_DIGILOCKER_REPO_SERVICE_RESPERROR); connection to DigiLocker failed.Retry the request after some time or contact the HyperVerge team if the issue persists
Was this helpful?
Ask AIBeta
Hi! How can I help?
Ask me anything about HyperVerge products, APIs, and SDKs.
Try asking: